﻿using System;
using System.Globalization;
using System.Windows.Data;
using SKYPE4COMLib;
using Wra4Skype.Library;

namespace Wra4Skype
{
    /// <summary>   
    /// A type converter to return user display name or full name if display name is not defined
    /// </summary>   
    public class DisplayNameConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var user = value as IUser;
            if (user == null) 
            {
                return value;
            }

            return user.GetDisplayName();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}